#!/usr/bin/env python3
"""
fastq_to_fasta.py
将FASTQ文件转换为FASTA格式
用法: python fastq_to_fasta.py input.fastq output.fasta
"""
import sys

def fastq_to_fasta(infile, outfile):
	with open(infile, 'r') as fin, open(outfile, 'w') as fout:
		whileTrue:
			header = fin.readline().strip()
			ifnot header:
				break
			seq = fin.readline().strip()
			fin.readline()  # 忽略 +
			fin.readline()  # 忽略质量行
			if header.startswith('@'):
				fasta_header = ">" + header[1:]
				fout.write(f"{fasta_header}\n{seq}\n")

if __name__ == "__main__":
	if len(sys.argv) != 3:
		print("用法: python fastq_to_fasta.py input.fastq output.fasta")
		sys.exit(1)
	fastq_to_fasta(sys.argv[1], sys.argv[2])